package com.hbsi.demo4;

import com.hbsi.demo2.Person;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

/**
 * @author 程奕红
 * @version 1.0
 */
public class TestStudent {
    public static void main(String[] args) {
        Class c1 = Student.class;
        Constructor[] constructors = c1.getConstructors();
        for (Constructor cons : constructors) {
            System.out.println("修饰符:" + Modifier.toString(cons.getModifiers()));
            System.out.println("名字:" + cons.getName());
            Class[] parameterTypes1 = cons.getParameterTypes();
            System.out.print("参数: ");
            for (Class<?> parameterType : parameterTypes1) {
                System.out.print(parameterType.getName() + " ");
            }


        }

        Method[] methods = c1.getMethods();
        Method[] methods1= c1.getDeclaredMethods();
        for(Method m:methods1){
            System.out.println(m);
        }
        for (Method method : methods) {
            System.out.println("修饰符:" + Modifier.toString(method.getModifiers()));
            System.out.println("名字:" + method.getName());
            Class[] parameterTypes1 = method.getParameterTypes();
            System.out.print("参数: ");
            for (Class<?> parameterType : parameterTypes1) {
                System.out.print(parameterType.getName() + " ");
            }


        }
    }
}